UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O1ZWCP9zKHrFNBVd85p5YFEETSJEdZP4sD6qywP4SOw=' 
WHERE 
  key_id = '2130e7f70391cccb0cad4c19576bc678776a16d519a526cee97944cefd1f0363' 
  AND (
    token = 'O1ZWCP9zKHrFNBVd85p5YFEETSJEdZP4sD6qywP4SOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025