UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qgq8T32e9364o7lFhOP2fpYWjRaqLp9K6lv1Tn0QXUA=' 
WHERE 
  key_id = '838a748f21d4ad5207ec231aee00c8efa58fb30e493ba7b5d1791b7360bdab32' 
  AND (
    token = 'qgq8T32e9364o7lFhOP2fpYWjRaqLp9K6lv1Tn0QXUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035