UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ffelRl3StK+EipW6thPu0CHhstCph3y7OI7QHhukD34=' 
WHERE 
  key_id = '1e0cd64bc1b49169dce58b1062949f4e71ea11e73427deee59e878c4321b5950' 
  AND (
    token = 'ffelRl3StK+EipW6thPu0CHhstCph3y7OI7QHhukD34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037