UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eRHMx0rCTh25X6gjqUXxR7i3CmXalJGwFRTIXbgChuA=' 
WHERE 
  key_id = '922dc283498524ff3698e6c75e5516b55519da7e0787ca86389bfe51c4d7c599' 
  AND (
    token = 'eRHMx0rCTh25X6gjqUXxR7i3CmXalJGwFRTIXbgChuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023