UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y/28SLNqj7+7uZtlxDJ9l+mFPBZjtOnM5Z9KLTo2qqc=' 
WHERE 
  key_id = '03ea85f56e24387af8913d8c6d3858cc0dfc246e0a51f9c69c1467981184827f' 
  AND (
    token = 'Y/28SLNqj7+7uZtlxDJ9l+mFPBZjtOnM5Z9KLTo2qqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031