UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N3kIf+sSqlh6xgmI78/4/T7LB90PIhVyUBnOY7XczhI=' 
WHERE 
  key_id = 'aae68d43129c1baab669ff2d06456c958a02f9aca5aa9f9f9027bd6da399af98' 
  AND (
    token = 'N3kIf+sSqlh6xgmI78/4/T7LB90PIhVyUBnOY7XczhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026