UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qCw/syuJIqcMH8VNFG8ffO+4p9dYuejFgakXudV5/KE=' 
WHERE 
  key_id = '152c9cfd49624e59ca010e639d562ff61281c58ce84c3f4ad69426d8c3f40e09' 
  AND (
    token = 'qCw/syuJIqcMH8VNFG8ffO+4p9dYuejFgakXudV5/KE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047