UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4/+HCmAAJHIMq6+sZ5AUvW6xKr+Njl4Ng8wWtBCgC4=' 
WHERE 
  key_id = '5a34a28ee5b62f12b49abb028e4230edb564edcb165efdad1325b4fb293ea0c3' 
  AND (
    token = 't4/+HCmAAJHIMq6+sZ5AUvW6xKr+Njl4Ng8wWtBCgC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034