UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r+pl9+s1amcl96swne5vcVKM/ahOEXisCX3rp+y49AM=' 
WHERE 
  key_id = 'e95cd0d2b2b35df5ad6ec72ec378407ef8543e218c37038519a9e00ddc01c720' 
  AND (
    token = 'r+pl9+s1amcl96swne5vcVKM/ahOEXisCX3rp+y49AM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017