UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7AijXC9/anbXKksdL3dllqHykU3f70nxZlqPOI0Zw9s=' 
WHERE 
  key_id = '4df80967741470f91d378cb6b4c19ad659c0c104563d546cefbcc384ba216edd' 
  AND (
    token = '7AijXC9/anbXKksdL3dllqHykU3f70nxZlqPOI0Zw9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039