UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X8kNPQgC86tHLLNji8bT0dkZdrw/s+lJexj3cG31JkI=' 
WHERE 
  key_id = '82a788a1dc4abbffac74f3adeb2206c20691e9b5c95f595fc5b810453ed482cd' 
  AND (
    token = 'X8kNPQgC86tHLLNji8bT0dkZdrw/s+lJexj3cG31JkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019