UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rnsz08RjfJ5l9u2oouPeFky4ic7Aiy6zzPImLIZtRhQ=' 
WHERE 
  key_id = '90b74a7a4a6846cdd8fcb3694d15b2f302aed05d1853140b3716e4cfbcbff275' 
  AND (
    token = 'Rnsz08RjfJ5l9u2oouPeFky4ic7Aiy6zzPImLIZtRhQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042