UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't10Z/jihz998qUfQfpY6QX7r0xAJmx0ps3iCOsnxFco=' 
WHERE 
  key_id = '4d93861ebb7bc7a587811550446f05af56411c44016bb5ca2a22faa3edd16d19' 
  AND (
    token = 't10Z/jihz998qUfQfpY6QX7r0xAJmx0ps3iCOsnxFco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032