UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XWJAuuMYUeFKYX76D5wA1UgSBnzQYNQA5t2EGAlq6Zs=' 
WHERE 
  key_id = 'bcb0addbd7580de742ecbbc080d78c1bbb829c2a407418d102ecee6e88ccd288' 
  AND (
    token = 'XWJAuuMYUeFKYX76D5wA1UgSBnzQYNQA5t2EGAlq6Zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044