UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sOK/4w2e9LKa4oPh42N+ILkCV3/2w1hhbF/pT4YuQVY=' 
WHERE 
  key_id = '38ac796c1658e717691a026753c09325a515fe8b38ad3573a14c5cc7b39622b2' 
  AND (
    token = 'sOK/4w2e9LKa4oPh42N+ILkCV3/2w1hhbF/pT4YuQVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022