UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kw74xBtzDz/36BL+WfqOgCif+GRcpE7CFv4r0MTvhrA=' 
WHERE 
  key_id = '58f41dd2ce530ea94f5328bf6561999c4f067cf93d711b2d4d7bf99f9ca217d9' 
  AND (
    token = 'kw74xBtzDz/36BL+WfqOgCif+GRcpE7CFv4r0MTvhrA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036