UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dat6HHhr4bpBebtAcsODb3YoEHIwfIrnkzALShjhZ7Y=' 
WHERE 
  key_id = '433e535c83c98e517aac01696a4184435e422a8b4aea892ea071ebeb05b3fd9a' 
  AND (
    token = 'Dat6HHhr4bpBebtAcsODb3YoEHIwfIrnkzALShjhZ7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040