UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CJbiU+5lj4OG31eLc2jMcmU25vMLk/KB7lCQ37ifklU=' 
WHERE 
  key_id = '3676fa537d1b3a38bb29bacd5726711343c84771012cf4b70b60136fe015bc95' 
  AND (
    token = 'CJbiU+5lj4OG31eLc2jMcmU25vMLk/KB7lCQ37ifklU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050