UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gZC0OPDmbiL9gFGg1P1+oygYYLqHKEAo2sMxM0PTA5Q=' 
WHERE 
  key_id = '061bc3a2f8e472d02122a224c00cb89afd10b8370111de351d57568c6e470bfa' 
  AND (
    token = 'gZC0OPDmbiL9gFGg1P1+oygYYLqHKEAo2sMxM0PTA5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030