UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y9L1STL6fsnNGh/bHSDURVFm9kcT95CwUNpD4V/49zY=' 
WHERE 
  key_id = '3335e5819fb2c6db5ad1d81f043569cef045e77cd4451f770d960e544383d45e' 
  AND (
    token = 'Y9L1STL6fsnNGh/bHSDURVFm9kcT95CwUNpD4V/49zY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047