UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JBN9NcvH8Kzz7Wiys7aYrq1zxkT/V49qT1w799FrjbU=' 
WHERE 
  key_id = 'd670de851bde3042201c23b83919dd87a47e5e1b005b6192eb8544d8a7c0bee4' 
  AND (
    token = 'JBN9NcvH8Kzz7Wiys7aYrq1zxkT/V49qT1w799FrjbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054