UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l3eOsxoIOHyMCK+xOq9QAyZIB9teN54A5row37pH9SA=' 
WHERE 
  key_id = 'b6497cbc30308c7cdb16a42c1e88add3cada0855e5ee8f35fb4c6ab0a2d5df81' 
  AND (
    token = 'l3eOsxoIOHyMCK+xOq9QAyZIB9teN54A5row37pH9SA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045