UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm8MDnrDrtJrVQmQVB6y8NuXn7skqD2CiMFS+vIv4AF4=' 
WHERE 
  key_id = '7ecdada0d770fb6c766c8131fa4a7cc12e529cd561c2be2158a37af6f0f3e57d' 
  AND (
    token = 'm8MDnrDrtJrVQmQVB6y8NuXn7skqD2CiMFS+vIv4AF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032