UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '25PqD6pJsGIyQM6fqZvzWZwvhZgdRu2zpFgRe2OgDtU=' 
WHERE 
  key_id = 'b9354ea66c900bb770cadbb55e7db2f3b3b84309c04f902fb73ea5e5a9ef6039' 
  AND (
    token = '25PqD6pJsGIyQM6fqZvzWZwvhZgdRu2zpFgRe2OgDtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032