UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mphohyi9l5Ql781hH78gDiPjGbvQ4isW5WW75UdUzQ4=' 
WHERE 
  key_id = '6b923ac48d99b51f6124b3e8409b77b2d3012703adbbcdf284ac36ea8daa913e' 
  AND (
    token = 'mphohyi9l5Ql781hH78gDiPjGbvQ4isW5WW75UdUzQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029