UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RxyJG0NjrsY8CnMkFe8Dp8yrysgSyV5uL+3O7dIwX2Y=' 
WHERE 
  key_id = '6a31e1d756784888f3d9c24bf06882b78a87f05abd254b5e401f33ca194027f0' 
  AND (
    token = 'RxyJG0NjrsY8CnMkFe8Dp8yrysgSyV5uL+3O7dIwX2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030