UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+hS3eRzucbWqovWVcTgDQe41pxvQmqiYaxD5R+Ld2Gw=' 
WHERE 
  key_id = '9ca6754f52cae62135e3b3bc5d34a1057ac54c144442e4d629cd96a172387729' 
  AND (
    token = '+hS3eRzucbWqovWVcTgDQe41pxvQmqiYaxD5R+Ld2Gw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029