UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nC080ythVN88aZnJUNYTDZRZocWjHFF+NzGCSk+JunI=' 
WHERE 
  key_id = 'a3d2b3fb4a9a6da27328a1d0d1151efa083ccde918d0040c082bc37bbc0b3477' 
  AND (
    token = 'nC080ythVN88aZnJUNYTDZRZocWjHFF+NzGCSk+JunI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039