UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pe7l8mONB/cES8nrKQ+tWBXnXc3l38IGP3kZtseu4Qc=' 
WHERE 
  key_id = '8fbe2d3f45f431fac160a0ad6f775dd34a9fb16323afb5999d1da46f676aa199' 
  AND (
    token = 'Pe7l8mONB/cES8nrKQ+tWBXnXc3l38IGP3kZtseu4Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058